package com.hevs.samplewebapp.client.bean;

import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.Response;

/**
 * 
 * @author
 * created : 
 * 
 * Goal :  
 * 
 */

/**
 * Synchronous REST call
 * <p> Fake a synchronous Callback. 
 * Send a class reference as a parameter to use the self-made refresh method. </p>
 * 
 * @author Schnidrig Peter
 * @date 30.04.2012
 */
public class FakeSyncRestCall implements RequestCallback{

	// ------------------------------------------------------------
	// VARIABLES
	// ------------------------------------------------------------

	/**
	 * refresh composite
	 * @see CompositeWRefresh
	 */
	public final CompositeWRefresh compClass;

	// ------------------------------------------------------------
	// CONSTRUCTOR
	// ------------------------------------------------------------

	/**
	 * Constructor of the call back
	 * 
	 * @param compClass
	 * 	the graphical component to refresh
	 */
	public FakeSyncRestCall(CompositeWRefresh compClass){
		this.compClass=compClass;
	}

	// ------------------------------------------------------------
	// METHODS
	// ------------------------------------------------------------

	/**
	 * Refresh the component
	 */
	public void refresh(){
		compClass.refreshComp();
	}

	@Override
	/**
	 * when error occurs
	 */
	public void onError(Request arg0, Throwable arg1) {
	}

	@Override
	/**
	 * when response received
	 */
	public void onResponseReceived(Request arg0, Response arg1) {
	}
}
